#include <iostream>
#include <stdio.h>
#include <fstream>
#include "/usr/local/include/pbc/pbc.h"
#include <gmp.h>
#include <gmpxx.h>
#include "mvsse.h"

using namespace std;

int main() {
    using namespace nlohmann;
    string jsonPath = "mvsse.json";
    json mvsseJson;
    std::ifstream i(jsonPath);
    i >> mvsseJson;

    json& owner = mvsseJson["owner"];
    json& users = mvsseJson["users"];
    json& server = mvsseJson["server"];
    // Setup(128, owner, users, server);

    // 设置 PRF 函数
    auto& prf1 = Singleton<PRF_1>::Instance();
    prf1.setup(mpz_class(owner["PRF_k1"].get<string>()), 256);
    auto& prf2 = Singleton<PRF_2>::Instance();
    prf2.setup(mpz_class(owner["PRF_k2"].get<string>()), 256);
    auto& prf3 = Singleton<PRF_3>::Instance();
    prf3.setup(mpz_class(owner["PRF_k3"].get<string>()), 256);

    Store(owner, users, server);

    ofstream o(jsonPath);
    o << setw(2) << mvsseJson << endl;
}